package screen 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import map.MapSource;
	/**
	 * ...
	 * @author Jeroen Gildemacher
	 */
	public class SimpleLayer extends Sprite
	{
		
		private var _scrollingBitmap:BitmapData;
		private var _parallaxAmount:Number = 1;
		private var _scaleAmount:Number = 1;
		
		private var _canvas:BitmapData;
		private var _startY:int;
		private var _layerHeight:int;		
		private var _mapSource:MapSource;		
		
		public function SimpleLayer(bitmapData:BitmapData, scaleFactor:int) 
		{
			_scrollingBitmap = bitmapData;	
			_canvas = new BitmapData(50, 50, true, 0xFF000000);
			var bitmap:Bitmap = new Bitmap(_canvas);
			bitmap.scaleX = scaleFactor;
			bitmap.scaleY = scaleFactor;
			addChild(bitmap);
		}
		public function drawCanvas(x:int, y:int ):void
		{
			if (x < 0) x = 0;
			if (x > 950) x = 950;
			
			if (y < 0) y = 0;
			if (y > 950) y = 950;
			_canvas.copyPixels(_scrollingBitmap, new Rectangle(x, y, 50, 50), new Point(0, 0));
		}
		public function get parallaxAmount():Number { return _parallaxAmount; }
 
		public function set parallaxAmount(value:Number):void
		{
			_parallaxAmount = value;
		}

		public function get scaleAmount():Number { return _scaleAmount; }
 
		public function set scaleAmount(value:Number):void
		{
			_scaleAmount = value;
			
		}
		
		public function get canvas():BitmapData 
		{
			return _canvas;
		}
		
		public function set canvas(value:BitmapData):void 
		{
			_canvas = value;
		}
		
		public function get scrollingBitmap():BitmapData 
		{
			return _scrollingBitmap;
		}
		
		public function set scrollingBitmap(value:BitmapData):void 
		{
			_scrollingBitmap = value;
		}
		
		
		
	}

}